<?php

class Resource_Block_Public extends Resource_Block_Abstract 
{
    
    /**
    * Return navigation.
    * 
    * @return array
    */
    protected function _navigation() 
    {
        $entries = Kernel::factory('Kernel', 'Resource')->menu($this->_name());
        
        // :KLUDGE: 20081006 dV: as menu is got from cach we force to walk through
        // array manually to set active resource
        foreach ($entries as &$entry) {
            $entry['active'] = $entry['id'] == Resource_Backend::active();
            $entry['backend_url'] = array('id' => $entry['id']);
        }
        
        return Kernel_Util_Tree::convert($entries);
    }
    
    /**
    * Return active resource.
    * 
    * @return integer
    */
    protected function _active() 
    {
        return Resource_Backend::active();
    }
    
}